<template>
  <div>11111111111111111111</div>
</template>
<script setup lang="ts">
import request, { fetch } from '@/utils/request'
import md5 from 'js-md5'

function addSign(params) {
  let sdic = Object.keys(params).sort()
  let signStr = ''
  sdic.forEach(item => {
    if (signStr == '') {
      signStr += item + '=' + params[item]
    } else {
      signStr += '&' + item + '=' + params[item]
    }
  })
  params.sign = md5(signStr).toUpperCase()
  return params
}

onMounted(() => {
  nextTick(() => {
    let params = addSign({ a: 1, b: 2, c: 3, d: 4 })

    request.get('/adv/test2', params).then(resp => {
      console.log(resp)
    })
  })
})
</script>
